import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InspectionVO, InspectionForm, InspectionQuery } from '@/api/system/inspection/types';

/**
 * 查询设备巡检列表
 * @param query
 * @returns {*}
 */

export const listInspection = (query?: InspectionQuery): AxiosPromise<InspectionVO[]> => {
  return request({
    url: '/system/inspection/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备巡检详细
 * @param id
 */
export const getInspection = (id: string | number): AxiosPromise<InspectionVO> => {
  return request({
    url: '/system/inspection/' + id,
    method: 'get'
  });
};

/**
 * 新增设备巡检
 * @param data
 */
export const addInspection = (data: InspectionForm) => {
  return request({
    url: '/system/inspection',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备巡检
 * @param data
 */
export const updateInspection = (data: InspectionForm) => {
  return request({
    url: '/system/inspection',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备巡检
 * @param id
 */
export const delInspection = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/inspection/' + id,
    method: 'delete'
  });
};
